﻿@model IList<BestsellersReportLineModel>

<div class="layui-row layui-col-space15">
    <div class="layui-col-sm12">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-sm6">
                <div class="layui-card">
                    <div class="layui-card-header">
                        @T("Admin.SalesReport.BestSellers.ByQuantity")
                    </div>
                    <div class="layui-card-body">
                        <div class="layui-tab-item layui-show">
                            <table id="bestsellers-byquantity-grid"></table>
                            <script type="text/html" id="layuiadmin-app-cont-tagsbar">
                                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-edit"></i>@T("Admin.Common.View")</a>
                            </script>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
    layui.use(['index','table'], function () {
        var index = layer.load(2, { shade: false });
        var table = layui.table
            , form = layui.form;
        //分类管理
        table.render({
            elem: '#bestsellers-byquantity-grid'
            ,method:'post'
            , url: '@Url.Action("BestsellersBriefReportByQuantityList", "Order")'
            , page: true
            , loading:true
            , limit: 30
            , limits: [15,30,50,100]
            , cols: [[
                , { field: 'GoodsName', title: '@T("Admin.SalesReport.Bestsellers.Fields.Name")' }
                , { field: 'TotalQuantity', title: '@T("Admin.SalesReport.Bestsellers.Fields.TotalQuantity")' }
                , { field: 'TotalAmount', title: '@T("Admin.SalesReport.Bestsellers.Fields.TotalAmount")' }
                , { title: '操作', width: 180, align: 'center', fixed: 'right', toolbar: '#layuiadmin-app-cont-tagsbar', style: 'height:90px;' }
            ]]
            , id: 'testReload'
            , text: { none: '一条数据也没有^_^' }
            , done: function () {
                layer.close(index);
            }
        });

        //监听工具条
        table.on('tool(bestsellers-byquantity-grid)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                var tr = $(obj.tr);
                window.location.href = '@Url.Content("~/Admin/Goods/Edit/")' + data.Id;
            }
        });
    });
    </script>
</div>
